<%@ page language="java" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@ taglib tagdir="/WEB-INF/tags" prefix="hh"%>
<%@ page import="com.mymail.entity.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.text.SimpleDateFormat"%>
<jsp:useBean id="user" class="com.mymail.entity.User" scope="session" />
<%
	request.setCharacterEncoding("utf-8");
	String foldername = request.getParameter("foldername");
	String box = request.getParameter("box");
	int pages = Integer.parseInt(request.getParameter("page"));
	if ("a".equals(foldername)) {
		foldername = user.getFolderName();
	}
	//当前页
	if (pages == 0) {
		pages = user.getCurrentpage();
	} else if (pages == -1) {
		//下一页
		pages = user.getCurrentpage() + 1;
	} else if (pages == -2) {
		//上一页
		pages = user.getCurrentpage() - 1;
	}
	//System.out.println(foldername + "9" + pages);
	Folder folder = user.findFolder(foldername);
	int count = folder.getCount();
	Iterator<Mail> it = user.getMails(foldername, pages).iterator();
	SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
%>
<div class="listmail">
	<div class="listtop">
		<p>
			<h3><%=foldername%></h3>
			<span style="font-size: 12px;">&nbsp;(共<%=count%>封)</span>
		</p>
		<p class="minfont" align="right">
			<a href="#">管理自定义的文件夹</a>
		</p>
	</div>
	<hh:listmenu pages="<%=pages %>" count="<%=count %>" />
	<!--  
	<div style="background:#f00">&nbsp;123这里怎么不显示啊!<br/>乍么回事</div>
	-->
	<div id="list">
		<table cellspacing="0" cellpadding="0">
			<tr class="first1">
				<td class="td1">
					&nbsp;
				</td>
				<td class="td2">
					附
				</td>
				<td class="td3">
					发件人
				</td>
				<td class="td4">
					邮件主题
				</td>
				<td class="td5">
					发送时间
				</td>
			</tr>
			<%
				int i = 0;
				while (it.hasNext()) {
					Mail mail = it.next();
			%>
			<tr onmousemove="liston(this)" onmouseout="listout(this)" id="<%=i%>">
				<td class="td1">
					<input type="checkbox" name="select" value="<%=i%>" />
				</td>
				<td class="td2" onclick="showmail(this)">
					0
				</td>
				<td class="td3" onclick="showmail(this)">
					<%=mail.getFrom()%>
				</td>
				<td class="td4" onclick="showmail(this)">
					<div><%=mail.getSubject()%><span>-<%=mail.getContent().replaceAll("<[^>]*>", "")%></span>
					</div>
				</td>
				<td class="td5" onclick="showmail(this)">
					<%=sf.format(mail.getSendTime())%>
				</td>
			</tr>
			<%
				++i;
				}
			%>
		</table>
	</div>
	<p style="font-size: 12px; color: #666">
		选择:
		<a href="#">全部</a>-
		<a href="#">已读</a>-
		<a href="#">末读</a>
	</p>

	<hh:listmenu pages="<%=pages %>" count="<%=count %>" />
</div>